﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Media;
using static System.Net.Mime.MediaTypeNames;

namespace Imitating.utils
{
    public class TextUtil : TextBlock
    {
        //private static FontFamily FontFamily = new FontFamily() { };
        //private static FontStyle FontStyle = new FontStyle() { };
        //private static FontWeight FontWeight = new FontWeight() { };
        //private static FontStretch FontStretch = new FontStretch() { };


        public Geometry CreateGeometry()
        {
            // Create the formatted text based on the properties set.
            FormattedText formattedText = new FormattedText(
                Text,
                CultureInfo.CurrentCulture,
                FlowDirection.LeftToRight,
                new Typeface(
                    FontFamily,
                    FontStyle,
                    FontWeight,
                    FontStretch),
                    FontSize,
                System.Windows.Media.Brushes.Black,// This brush does not matter since we use the geometry of the text.
                100);
            // Build the geometry object that represents the text.

            return formattedText.BuildGeometry(new Point(0, 0));
        }

        
    }

    public class TestDraw1 : UIElement
    {
        // Override the OnRender call to add a Background and Border to the OffSetPanel
        protected override void OnRender(DrawingContext dc)
        {
            SolidColorBrush mySolidColorBrush = new SolidColorBrush();
            mySolidColorBrush.Color = Colors.LimeGreen;
            Pen myPen = new Pen(Brushes.Blue, 10);
            Rect myRect = new Rect(0, 0, 500, 500);
            dc.DrawRectangle(mySolidColorBrush, myPen, myRect);
        }

        
    }
}
